home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat2 / standard / socket.z / socket
Encoding:
Text File  |  1998-10-20  |  7.5 KB  |  198 lines

  1.  
  2.  
  3.  
  4. SSSSOOOOCCCCKKKKEEEETTTT((((2222))))                                                            SSSSOOOOCCCCKKKKEEEETTTT((((2222))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      socket - create an endpoint for communication
  10.  
  11. CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ttttyyyyppppeeeessss....hhhh>>>>
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ssssoooocccckkkkeeeetttt....hhhh>>>>
  14.      iiiinnnntttt ssssoooocccckkkkeeeetttt((((iiiinnnntttt ddddoooommmmaaaaiiiinnnn,,,, iiiinnnntttt ttttyyyyppppeeee,,,, iiiinnnntttt pppprrrroooottttooooccccoooollll))));;;;
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      _S_o_c_k_e_t creates an endpoint for communication and returns a descriptor.
  18.  
  19.      The _d_o_m_a_i_n parameter specifies a communications domain within which
  20.      communication will take place; this selects the protocol family which
  21.      should be used.  The protocol family generally is the same as the address
  22.      family for the addresses supplied in later operations on the socket.
  23.      These families are defined in the include file <_s_y_s/_s_o_c_k_e_t._h>.  The
  24.      currently understood formats are:
  25.  
  26.           PF_INET     (DARPA Internet protocols)
  27.           PF_RAW      (Link-level protocols)
  28.           PF_UNIX     (4.3BSD UNIX internal protocols)
  29.      The formats PF_NS (Xerox Network Systems protocols) and PF_IMPLINK (IMP
  30.      link layer) are not implemented.
  31.  
  32.      The socket has the indicated _t_y_p_e, which specifies the semantics of
  33.      communication.  Currently implemented types are:
  34.  
  35.           SOCK_STREAM
  36.           SOCK_DGRAM
  37.           SOCK_RAW
  38.  
  39.      A SOCK_STREAM type provides sequenced, reliable, two-way connection based
  40.      byte streams.  An out-of-band data transmission mechanism may be
  41.      supported.  A SOCK_DGRAM socket supports datagrams (connectionless,
  42.      unreliable messages of a fixed (typically small) maximum length).
  43.      SOCK_RAW sockets, which are available only to the super-user, provide
  44.      access to internal network protocols and interfaces.  The types
  45.      SOCK_SEQPACKET and SOCK_RDM are currently unimplemented.
  46.  
  47.      The _p_r_o_t_o_c_o_l specifies a particular protocol to be used with the socket.
  48.      Normally only a single protocol exists to support a particular socket
  49.      type within a given protocol family.  However, it is possible that many
  50.      protocols may exist, in which case a particular protocol must be
  51.      specified in this manner.  The protocol number to use is particular to
  52.      the "communication domain" in which communication is to take place; see
  53.      _g_e_t_p_r_o_t_o_e_n_t(3N).
  54.  
  55.      Sockets of type SOCK_STREAM are full-duplex byte streams, similar to
  56.      pipes.  A stream socket must be in a _c_o_n_n_e_c_t_e_d state before any data may
  57.      be sent or received on it.  A connection to another socket is created
  58.      with a _c_o_n_n_e_c_t(2) call.  Once connected, data may be transferred using
  59.  
  60.  
  61.  
  62.                                                                         PPPPaaaaggggeeee 1111
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69. SSSSOOOOCCCCKKKKEEEETTTT((((2222))))                                                            SSSSOOOOCCCCKKKKEEEETTTT((((2222))))
  70.  
  71.  
  72.  
  73.      _r_e_a_d(2) and _w_r_i_t_e(2) calls or some variant of the _s_e_n_d(2) and _r_e_c_v(2)
  74.      calls. Note that for the _r_e_a_d and _r_e_c_v-style calls, the number of bytes
  75.      actually read may be less than the number requested.  When a session has
  76.      been completed a _c_l_o_s_e(2) may be performed.  Out-of-band data may also be
  77.      transmitted as described in _s_e_n_d(2) and received as described in _r_e_c_v(2).
  78.  
  79.      The communications protocols used to implement a SOCK_STREAM insure that
  80.      data is not lost or duplicated.  If a piece of data for which the peer
  81.      protocol has buffer space cannot be successfully transmitted within a
  82.      reasonable length of time, then the connection is considered broken and
  83.      calls will indicate an error with -1 returns and with ETIMEDOUT as the
  84.      specific code in the global variable errno.  The protocols optionally
  85.      keep sockets "warm" by forcing transmissions roughly every minute in the
  86.      absence of other activity.  An error is then indicated if no response can
  87.      be elicited on an otherwise idle connection for a extended period (e.g. 5
  88.      minutes).  A SIGPIPE signal is raised if a process sends on a broken
  89.      stream; this causes naive processes, which do not handle the signal, to
  90.      exit.
  91.  
  92.      SOCK_DGRAM and SOCK_RAW sockets allow sending of datagrams to
  93.      correspondents named in _s_e_n_d(2) calls.  Datagrams are generally received
  94.      with _r_e_c_v_f_r_o_m(2), which returns the next datagram with its return
  95.      address.
  96.  
  97.      An _f_c_n_t_l(2) call can be used to specify a process group to receive a
  98.      SIGURG signal when the out-of-band data arrives.  The FIONBIO i/o control
  99.      (see _i_o_c_t_l(2)) or the FNDELAY fcntl (see _f_c_n_t_l(2)) enable non-blocking
  100.      I/O and asynchronous notification of I/O events via SIGIO.
  101.  
  102.      The operation of sockets is controlled by socket level _o_p_t_i_o_n_s.  These
  103.      options are defined in the file <_s_y_s/_s_o_c_k_e_t._h>.  _s_e_t_s_o_c_k_o_p_t(2) and
  104.      _g_e_t_s_o_c_k_o_p_t(2) are used to set and get options, respectively.
  105.  
  106. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
  107.      A -1 is returned if an error occurs, otherwise the return value is a
  108.      descriptor referencing the socket.
  109.  
  110. EEEERRRRRRRROOOORRRRSSSS
  111.      The _s_o_c_k_e_t call fails if:
  112.  
  113.      [EPROTONOSUPPORT]        The protocol type or the specified protocol is
  114.                               not supported within this domain.
  115.  
  116.      [EMFILE]                 The per-process descriptor table is full.
  117.  
  118.      [ENFILE]                 The system file table is full.
  119.  
  120.      [EACCESS]                Permission to create a socket of the specified
  121.                               type and/or protocol is denied.
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.                                                                         PPPPaaaaggggeeee 2222
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135. SSSSOOOOCCCCKKKKEEEETTTT((((2222))))                                                            SSSSOOOOCCCCKKKKEEEETTTT((((2222))))
  136.  
  137.  
  138.  
  139.      [ENOBUFS]                Insufficient buffer space is available.  The
  140.                               socket cannot be created until sufficient
  141.                               resources are freed.
  142.  
  143. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  144.      accept(2), bind(2), connect(2), fcntl(2), getsockname(2), getsockopt(2),
  145.      ioctl(2), listen(2), read(2), recv(2), select(2), send(2), socketpair(2),
  146.      write(2), inet(7F), raw(7F), unix(7F)
  147.  
  148. NNNNOOOOTTTTEEEE
  149.      ABI-compliant versions of the above calls can be obtained from
  150.      _l_i_b_s_o_c_k_e_t._s_o.
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.                                                                         PPPPaaaaggggeeee 3333
  195.  
  196.  
  197.  
  198.